const params = require('./src/config/config')
const getToken = require("./src/getToken/index")
const sendMessage = require("./src/sendMessage/index")
const getWeather = require("./src/utils/getWeather")
const getLovedMsg = require("./src/utils/getLovedMsg")

const start = async () => {
  const access_token = await getToken(params)
  const {
    time,
    tem1,
    tem2,
    wea,
    air_tips
  } = await getWeather()
  const love = await getLovedMsg()
  sendMessage({
    ...params,
    access_token,
    data: {
      nowDate: {
        value: time,
        color: '#57E632'
      },
      city: {
        value: '茂名',
        color: '#1660AA'
      },
      wether: {
        value: wea,
        color: "#4A1E23"
      },
      low: {
        value: tem2,
        color: "#836C71"
      },
      high: {
        value: tem1,
        color: "#35282E"
      },
      tip: {
        value: air_tips,
        color: "#1AA280"
      },
      txt: {
        value: love,
        color: '#ffa500'
      }
    }
  }).then(res => {
    console.log("发送成功！请在微信查看消息");
  })
}

start()
